package com.neu.cpspgateway.service.impl;

import com.neu.cpspgateway.dao.UserMapper;
import com.neu.cpspgateway.pojo.User;
import com.neu.cpspgateway.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public User login(String userName, String password) {
        Map<String, Object> map = new HashMap<>();
        map.put("userName", userName);
        map.put("password", password);
        return userMapper.selectByNamePassword(map);
    }

    @Override
    public Integer selectIdByName(String userName) {
        return userMapper.selectIdByName(userName);
    }
}
